<?php
class ConnectDb{
    public $servername = "localhost";
    public $username = "root";
    public $password = "";
    public $dbname = "php-itq";
    public function __construct(){
        // Create connection
        $conn = @mysql_connect($this->servername, $this->username, $this->password);
        // Check connection

        if (!$conn) {
            die("Connection failed: ");
        }else{
            echo "Connected successfully";
        }
        return $conn;

    }
    public function showNote(){
        $conn = new mysqli($this->servername, $this->username, $this->password, $this->dbname);
        if ($conn->connect_error) {
            die("Connection failed: " . $conn->connect_error);
        }
        $sql = "SELECT id, title, content FROM note";
        $result = $conn->query($sql);

        $note = NULL;
        if ($result->num_rows > 0) {
            // output data of each row
            while($row = $result->fetch_assoc()) {
                $note[] = $row;
            }
            return($note);
        }
    }

    public function selectAll(){

    }
}
$Content = new ConnectDb();
$a = $Content->showNote();

?>
